<%@ page language="java" contentType="text/html; charset=utf8"
	pageEncoding="utf8"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf8">
	<title><spring:message code="order.title" /></title>
	<style>
body, td {font-family:verdana;font-size:10pt;}
</style>
<script type="text/javascript">

function changeRoom() {
	var selectedItem = document.getElementById("selectedItem");
	var txtCodeObj = document.getElementById('txtCode');
	txtCodeObj.value = selectedItem.options[selectedItem.selectedIndex].text;

}
</script>
	
</head>
<body>


  
<h2><spring:message code="order.title" /></h2>

<form:form method="post" action="/fixation/rest/addorder" commandName="order">

	<table>
		<tr>
        <td><form:label path="manager">
				<spring:message code="order.manager" />
			</form:label></td>
			<td>
           <select name="manager" >
            <c:forEach items="${managerList}" var="man">
               <option value="${man.id}">${man.surname}
            </c:forEach>
        	</select>
 			</td>
		</tr>
		<tr>
			<td><form:label path="day">
				<spring:message code="order.day" />
			</form:label></td>
			<td><form:input path="day" /></td>
		</tr>
		<tr>
			<td><form:label path="start">
				<spring:message code="order.start" />
			</form:label></td>
			<td><form:input path="start" /></td>
		</tr>
		<tr>
			<td><form:label path="end">
				<spring:message code="order.end" />
			</form:label></td>
			<td><form:input path="end" /></td>
		</tr>
		<tr>
			<td colspan="2"><input type="submit"
				value="<spring:message code="order.validateorder"/>" /></td>
		</tr>
				<tr>
 			<td><form:label path="room">
				<spring:message code="order.room" />
			</form:label></td>
			<td>
           <select name="room" >
            <c:forEach items="${roomList}" var="room">
               <option value="${room.id}">${room.name}&nbsp;${room.volume}
            </c:forEach>
        	</select>
 			</td>
		</tr>
		
		<tr>
			<td colspan="2"><input type="submit"
				value="<spring:message code="order.addorder"/>" /></td>
		</tr>
	</table>
</form:form>

<h3><spring:message code="order.request" /></h3>
<c:if test="${!empty orderList}">
	<table class="data">
		<tr>
			<th><spring:message code="order.room" /></th>
			<th><spring:message code="order.manager" /></th>
			<th><spring:message code="order.day" /></th>
			<th><spring:message code="order.start" /></th>
			<th><spring:message code="order.end" /></th>
			<th>&nbsp;</th>
		</tr>
		<c:forEach items="${orderList}" var="order">
			<tr>
				<td>${order.room.name}</td>
				<td>${order.manager.surname}</td>
				<td>${order.day}</td>
				<td>${order.start}</td>
				<td>${order.end}</td>
			</tr>
		</c:forEach>
	</table>
</c:if>


</body>
</html>